package com.garen.sys.web;

import com.garen.sys.biz.IFireMenuBiz;
import com.garen.sys.entity.FireMenu;
import org.springframework.stereotype.Controller;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import com.garen.common.*;
import org.springframework.web.servlet.ModelAndView;
import com.garen.sys.filter.SysFilter;


@Controller
@RequestMapping("/sys")
public final class FireMenuAction extends BaseAction{

	protected static Log log = LogFactory.getLog(FireMenuAction.class);

	@Autowired
	private IFireMenuBiz iFireMenuBiz;

	@RequestMapping("/firemenu/json") 
	public ModelAndView json(PageBean<FireMenu> pb,FireMenu fireMenu) {
		iFireMenuBiz.getFireMenuList(pb,fireMenu);
		return Json(pb);
	}

	@RequestMapping("/firemenu/boxJson") 
	public ModelAndView boxJson(FireMenu fireMenu) {
		return Json(iFireMenuBiz.getFireMenuList(fireMenu));
	}

	@RequestMapping("/firemenu/edit") 
	public ModelAndView edit(ModelAndView mav,FireMenu fireMenu) {
		mav.setViewName("sys/FireMenuEdit");
		if(fireMenu.getMenuId() != null){
			fireMenu=iFireMenuBiz.getFireMenu(fireMenu);
		}
		mav.addObject("fireMenu",fireMenu);
		return mav;
	}

	@RequestMapping("/firemenu/save") 
	public ModelAndView save(FireMenu fireMenu) {
		MsgBean mbean = SysFilter.getMsgBean(0, "保存成功 !");
		iFireMenuBiz.saveFireMenu(mbean,fireMenu);
		return Json(mbean);
	}

	@RequestMapping("/firemenu/del") 
	public ModelAndView del(FireMenu fireMenu) {
		MsgBean mbean = SysFilter.getMsgBean(0, "删除成功 !");
		iFireMenuBiz.delFireMenu(mbean,fireMenu);
		return Json(mbean);
	}

}
